BUILDDIR = build-test
SRCDIR = src
TESTDIR = testing
INCLUDE = -I include

$(BUILDDIR)/test-hal-emu: $(BUILDDIR)/test-hal.o $(BUILDDIR)/hal-emu.o
	gcc -o $(BUILDDIR)/test-hal-emu $(BUILDDIR)/test-hal.o $(BUILDDIR)/hal-emu.o -lcunit

$(BUILDDIR)/test-fs-emu: $(BUILDDIR)/test-fs.o $(BUILDDIR)/hal-emu.o $(BUILDDIR)/fs.o $(BUILDDIR)/state.o
	gcc -o $(BUILDDIR)/test-fs-emu $(BUILDDIR)/test-fs.o $(BUILDDIR)/hal-emu.o $(BUILDDIR)/fs.o $(BUILDDIR)/state.o -lcunit

$(BUILDDIR)/test-hal.o: $(TESTDIR)/test_hal.c Makefile
	gcc -c -g -o $(BUILDDIR)/test-hal.o $(INCLUDE) $(TESTDIR)/test_hal.c

$(BUILDDIR)/test-fs.o: $(TESTDIR)/test_fs.c Makefile
	gcc -c -g -o $(BUILDDIR)/test-fs.o $(INCLUDE) $(TESTDIR)/test_fs.c

$(BUILDDIR)/hal-emu.o: $(SRCDIR)/hal-emu.c Makefile
	gcc -c -g -o $(BUILDDIR)/hal-emu.o $(INCLUDE) -DDEBUG $(SRCDIR)/hal-emu.c

$(BUILDDIR)/fs.o: $(SRCDIR)/fs.c Makefile
	gcc -c -g -o $(BUILDDIR)/fs.o $(INCLUDE) -DDEBUG $(SRCDIR)/fs.c

$(BUILDDIR)/state.o: $(SRCDIR)/state.c Makefile
	gcc -c -g -o $(BUILDDIR)/state.o $(INCLUDE) -DDEBUG $(SRCDIR)/state.c
